<template>
    <div class="login">
        <h2>登录</h2>
        <button @click="login">登录</button>
    </div>
</template>
<script lang="ts">
import Vue from 'vue'
import { Component } from 'vue-property-decorator'
@Component({})
export default class Login extends Vue {
    public login():void{
        window.axios({
            url: '/data/login.json',
            method: 'post',
            data: {username: 'list',password: '123'}
        }).then(res=>{
            if(res.data.err === 0){
                console.log(res.data)
                // 种token到localStorage
                // window.localStorage.setItem('user', JSON.stringify(res.data));
                // // 跳转之前的页面
                // this.$router.replace(this.$route.query.path as string) // 断言
            }
        })
    }
}
</script>